package com.wthink.hzgj.version

import android.os.Bundle

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.navigation.findNavController
import com.wthink.hzgj.R
import com.wthink.hzgj.databinding.FragmentVersionBinding


class VersionFragment :Fragment(){

    private val viewModel by viewModels<VersionViewModel>()

    private lateinit var binding: FragmentVersionBinding

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = DataBindingUtil.inflate(
            inflater,
            R.layout.fragment_version,
            container,
            false
        )
        binding.viewModel = viewModel
        binding.lifecycleOwner = this

        return binding.root
    }

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)

        binding.back.setOnClickListener {
            it.findNavController().popBackStack()
        }

        viewModel.getVersion()
    }
}